package org.atovio.blog.service.impl;

import lombok.RequiredArgsConstructor;
import org.atovio.blog.mapper.PeopleMapper;
import org.atovio.blog.model.pojo.People;
import org.atovio.blog.service.PeopleService;
import org.atovio.blog.settings.PeopleSettings;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author AtoVio, Winter Yuan
 */
@Service
@RequiredArgsConstructor // 有参构造方法
public class PeopleServiceImpl implements PeopleService {

    // 因为存在有参构造方法，构造注入，所以就不需要自动装配了
    private final PeopleMapper peopleMapper;
    private final PeopleSettings peopleSettings;

    @Override
    public List<People> queryTopPeople() {
        Integer lowRead = peopleSettings.getLowRead();
        Integer topShow = peopleSettings.getTopShow();
        return peopleMapper.topShowIdBigger(lowRead, topShow);
    }
}
